package com.tempjob.common.businesss.mongo.entity;

import com.anwen.mongo.annotation.ID;
import com.anwen.mongo.annotation.collection.CollectionField;
import com.anwen.mongo.annotation.collection.CollectionName;
import com.anwen.mongo.enums.FieldFill;
import com.anwen.mongo.enums.IdTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Version;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 系统用户
 *
 * @TableName sys_user
 */
@CollectionName(value = "sys_admin")
@Data
public class SysAdmin implements Serializable {

    @ID(type = IdTypeEnum.OBJECT_ID)
    @CollectionField("_id")
    @ApiModelProperty("用户id")
    private String id;

    @CollectionField(value = "username")
    @ApiModelProperty("账户名称")
    private String username;

    @CollectionField(value = "salt")
    @ApiModelProperty(value = "加密盐值", hidden = true)
    private String salt;

    @CollectionField(value = "password")
    @ApiModelProperty(value = "用户密码密文", hidden = true)
    private String password;

    @CollectionField(value = "phone")
    @ApiModelProperty(value = "手机号码")
    private String phone;

    @CollectionField(value = "telephone")
    @ApiModelProperty("办公电话")
    private String telephone;

    @CollectionField(value = "college_ids")
    @ApiModelProperty("学院id")
    private List<String> collegeIds;

    @CollectionField(value = "college_id")
    @ApiModelProperty("学院id")
    private String collegeId;

    @CollectionField(value = "real_name")
    @ApiModelProperty("真实名称")
    private String realName;

    @CollectionField(value = "status")
    @ApiModelProperty(value = "账户状态(1.正常 2.锁定 )", hidden = true)
    private Integer status;

    @CollectionField(value = "super_admin")
    @ApiModelProperty(value = "是否管理员", hidden = true)
    private Boolean superAdmin;

    @CollectionField(value = "deleted")
    @ApiModelProperty(value = "是否删除(1未删除；0已删除)", hidden = true)
    private Integer deleted;

    @CollectionField(value = "update_id")
    @ApiModelProperty(value = "更新人", hidden = true)
    private String updateId;

    @CollectionField(value = "update_time")
    @ApiModelProperty(value = "", hidden = true)
    private Date updateTime;

    @CollectionField(value = "login_times")
    @ApiModelProperty(value = "", hidden = true)
    private Integer loginTimes;

    @CollectionField(value = "last_login_time")
    @ApiModelProperty(value = "", hidden = true)
    private Date lastLoginTime;

    @CollectionField(value = "last_login_ip")
    @ApiModelProperty(value = "", hidden = true)
    private String lastLoginIp;

    @CollectionField(value = "oper_time",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间",hidden = true)
    private Date operTime;

    @CollectionField(value = "oper_id",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人id",hidden = true)
    private String operId;

    @CollectionField(value = "oper_name",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人",hidden = true)
    private String operName;

    @CollectionField(value = "create_id",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人id",hidden = true)
    private String createId;

    @CollectionField(value = "create_name",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人",hidden = true)
    private String createName;

    @CollectionField(value = "create_time",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间",hidden = true)
    private Date createTime;

    @Version
    @CollectionField("version")
    @ApiModelProperty(value = "乐观锁", hidden = true)
    private Integer version;

    @CollectionField(exist = false)
    private static final long serialVersionUID = 1L;
}
